<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE html>
<html>
<head lang="en">

    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="${pageContext.request.contextPath}/css/searchCenter.css" rel=" stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/head.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/dist/css/bootstrap.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/dist/css/bootstrap-theme.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.mobile.css">
    <script src="${pageContext.request.contextPath}/layui/layui.js" charset="utf-8"></script>
    <script src="${pageContext.request.contextPath}/js/jquery-3.4.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/dist/js/bootstrap.js"></script>
    <link rel="icon" href="${pageContext.request.contextPath}/images/top_logo.ico">

    <title>职位搜索</title>

</head>
<script>

    function iframe() {
        var sms = "";//接收session中的信息
        var perName = $("#perName").val();
        console.log(perName)
        $.ajax({
            url: "${pageContext.request.contextPath}/login/index",
            type: "post",
            data: {   //数据传输到服务器

            },
            dataType: "json",

            success: function (result) {
                sms = result.data;
                console.log(sms);
                if (sms != null) {
                    perName = sms.perName;
                    console.log(perName);
                    $(".dropbtn").children(":first").children(":last-child").hide();
                    var perName1 = $(".dropbtn").append($(".dropbtn").children(":first").children(":first").text());
                    console.log(perName1);
                    perName1.text(perName)
                    // perName1.html(regist)

                } else {
                    $(".dropdown").children(":last-child").hide();
                    $(".dropdown").children(":first").children(":first").children("img").hide();
                }

            }


        })
    }
</script>
<body onload="iframe()">

<jsp:include page="../head.jsp"></jsp:include>

<div class="main">
    <div class="jxlr-search">
        <form class="layui-form">
            <div class="search-base">

                <div class="layui-form-item" style="margin-top: 20px">
                    <label class="layui-form-label" style="font-weight: 700;font-size: 16px"><span
                            style="font-size: 16px;display: inline-block;width: 80px;margin-left: -10px">基本搜索：</span></label>
                    <div class="layui-input-inline base" style="width: 120px">
                        <select name="salary" lay-filter="salary">
                            <option value="">请选择月薪</option>
                            <option value="1-2千">1-2千</option>
                            <option value="2-3千">2-3千</option>
                            <option value="3-5千">3-5千</option>
                            <option value="5-8千">5-8千</option>
                            <option value="0.8-1万">0.8-1万</option>
                            <option value="1-1.5万">1-1.5万</option>
                            <option value="1.5-2.5万">1.5-2.5万</option>
                            <option value="2.5-4万">2.5-4万</option>
                            <option value="4万以上">4万以上</option>
                        </select>
                    </div>
                    <div class="layui-input-inline" style="width: 150px">
                        <select name="companyType" lay-filter="companyType">
                            <option value="">请选择公司类型</option>
                            <option value="国企">国企</option>
                            <option value="外资（欧美）">外资（欧美）</option>
                            <option value="上市公司">上市公司</option>
                            <option value="外资（非欧美）">外资（非欧美）</option>
                            <option value="合资">合资</option>
                            <option value="民营公司">民营公司</option>
                        </select>
                    </div>
                    <div class="layui-input-inline" style="width: 150px">
                        <select name="education" lay-filter="education">
                            <option value="">请选择学历要求</option>
                            <option value="高中">高中</option>
                            <option value="中技">中技</option>
                            <option value="中专">中专</option>
                            <option value="大专">大专</option>
                            <option value="本科">本科</option>
                            <option value="硕士">硕士</option>
                            <option value="博士">博士</option>
                        </select>
                    </div>
                    <div class="layui-input-inline" style="width: 140px">
                        <select name="companySize" lay-filter="companySize">
                            <option value="">选择公司规模</option>
                            <option value="少于100">少于100</option>
                            <option value="100人-150人">100人-150人</option>
                            <option value="150人-500人">150人-500人</option>
                            <option value="500人-1000人">500人-1000人</option>
                            <option value="1000人-5000人">1000人-5000人</option>
                            <option value="5000人-10000人">5000人-10000人</option>
                            <option value="10000人以上">10000人以上</option>
                        </select>

                    </div>
                    <div class="layui-input-inline" style="width: 150px">
                        <input class="search-ready" id="sea" type="button" value="选好啦"style="color: white;font-size: 18px;
                     background-color:#ff8c00;border-radius: 5px"/>
                    </div>

                  <%--  <div class="search-ready">
                        <input class="click" id="sea" type="button" value="选好啦"style="width: 100%;height: 100%;color: white;font-size: 18px;
                     background-color:#ff8c00;;border: hidden;border-radius: 5px"/>
                    </div>--%>
                </div>
            </div>

        </form>
    </div>
    <div class="tlc" id="user-show" style="width: 1093px;margin-left: 163px;">
        <div class="on">
            <span class="t1"> 职位名</span>
            <span class="t2"> 公司名</span>
            <span class="t3">工作地点</span>
            <span class="t4">薪资（月薪）</span>
        </div>
        <div class="jobList" id="jobList"style="height: auto!important; width: 100%;background-color: #ffffff; border-bottom: 1px solid #e8e8e8;padding-top:12px ;">

            <c:forEach items="${searchCenterList}" var="searchrecruit">
                <div style="height: 20px; margin: auto">
                <div div style="width: 250px;float: left;text-align: center;margin-left: -20px;"><a href="${pageContext.request.contextPath}/search/recruit/${searchrecruit.recruit.recId}/">
                    <span class="title-job" style="text-align: center">${searchrecruit.recruit.recName} </span>
                </a></div>

                    <div style="width: 250px;float: left;text-align: center;margin-left: 50px;"><span class="title1" style="text-align: center">  <a href="${pageContext.request.contextPath}/recruit/${searchrecruit.recruit.recId}">${searchrecruit.company.companyName}</a> </span></div>
                <div style="width: 250px;float: left;text-align: center;margin-left: 35px;"><span class="title2" style="text-align: center">${searchrecruit.recruit.recJobAddress}</span></div>
               <div style="width: 250px;float: left;text-align: center;margin-left: 20px;"> <span class="title3" style="text-align: center">
                   ${searchrecruit.recruit.recJobSalary} </a>
            </span></div>
                <div class="main-bottom"></div>
                </div>
            </c:forEach>
        </div>

        <div id="demo0" style="margin-left: 800px;width: 400px"></div>
    </div>
    <br>
    <br>
<div class="main-bottom"></div>
<div class="bottom">
    <div class="bottom1" >
        <li><strong>联系方式:</strong></li>
            <li> 18168359175</li>


    </div>
    <div class="bottom2">
        <ul>
            <li><strong>简介</strong></li>
            <li> 关于我们</li>
            <li> 服务声明</li>
            <li>媒体报道</li>
        </ul>
    </div>
    <div class="bottom3">
        <ul>
            <li><strong>合作</strong></li>
            <li> 加入我们</li>
            <li> 联系我们</li>
            <li>友情链接</li>
        </ul>

    </div>
    <div class="bottom4">

        <ul>
            <li><strong>帮助</strong></li>
            <li> 帮助中心</li>
            <li> 常见问题</li>
            <li>新手引导</li>
        </ul>
    </div>
    <div class="bottom5">

        <ul>
            <li><strong>导航</strong></li>
            <li> 网站地图</li>
            <li> 职位搜索</li>
            <li>简历中心</li>
            <li> 企业名录</li>
        </ul>
    </div>
    <div class="bottom6">
        <img src="${pageContext.request.contextPath}/images/NaXian.png">
        <p>服务号</p>
    </div>
</div>
<script>

    var pageNo = 1;
    var salary = '';
    var companyType = '';
    var companySize = '';
    var education = '';

    loadAllJob();
    function loadAllJob(){
        $.ajax({
            url: "${pageContext.request.contextPath}/recruitList/selectStyle",
            data: {
                "pageNo": 1

            },
            type: "post",
            dataType: "JSON",
            success: function (result) {
                if (result.code == 1) {
                    return layer.msg(result.message, {time: 2000, icon: 6})
                }
                console.log(result);
                var l = result.data.list;
                console.log(l);
                var content = "";
                $.each(l, function (index, object) {
                    content +='<div style="height: 16px;margin-bottom: 5px;">';
                    content +='<div style="width: 250px;float: left;text-align: center;margin-left: -20px;">';
                    content += ' <span class="title-job">';
                    content += '<a href="${pageContext.request.contextPath}/search/recruit/'+object.recId+ '/">';
                    content += ''+ object.recName +'</a></span></div>';
                    content += '<div  style="width: 250px;float: left;text-align: center;margin-left: 50px;"><span class="title1">' ;
                    content += ' <a href="${pageContext.request.contextPath}/recruit/' + object.recId+'/">';
                    content +=''+ object.companyName + '</a></span></div>';
                    content += '<div  style="width: 250px;float: left;text-align: center;margin-left: 35px;"><span class="title2">' + object.recJobAddress + '</span></div>';
                    content += '<div  style="width: 250px;float: left;text-align: center;margin-left: 20px;"><span  class="title3">';
                    content += ' ' + object.recJobSalary + '</a>';
                    content += ' </span></div>';
                    content +='</div>';
                    content +='<br>';
                    $("#jobList").append(content);
                    content = "";
                });
                Sfgetpages(result);
            }
    })
        function Sfgetpages(result){
            layui.use(['laypage','layer'],function(){
                var laypage = layui.laypage
                    ,layer = layui.layer;
                laypage.render({
                    elem:'demo0',
                    theme: '#ff8c00',
                    count:result.data.total,
                    limit:16,
                    curr:pageNo,
                    jump:function(obj,first){
                        pageNo = obj.curr;
                        if(!first){
                            search(pageNo,salary,companyType,companySize,education);
                            $("#jobList").empty("");
                        }
                    }

                });
            })
        }
    }

    function search(pageNo, salary, companyType, companySize, education) {
        console.info("sdjkhasdjkhasjkdhas");
        console.info(companySize);
        $.ajax({
            url: "${pageContext.request.contextPath}/recruitList/selectStyle",
            data: {
                "pageNo": pageNo,
                "salary": salary,
                "education": education,
                "companyType": companyType,
                "companySize": companySize
            },
            type: "post",
            dataType: "JSON",
            success: function (result) {
                if (result.code == 1) {
                    return layer.msg(result.message, {time: 2000, icon: 6})
                }
                console.log(result);
                var l = result.data.list;
                console.log(l);
                var content = "";
                $.each(l, function (index, object) {
                    content +='<div style="height: 16px;margin-bottom: 5px;">';
                    content +='<div style="width: 250px;float: left;text-align: center;margin-left: -20px;">';
                    content += ' <span class="title-job">';
                    content += '<a href="${pageContext.request.contextPath}/search/recruit/'+object.recId+ '/">';
                    content += ''+ object.recName +'</a></span></div>';
                    content += '<div  style="width: 250px;float: left;text-align: center;margin-left: 50px;"><span class="title1">' ;
                    content += ' <a href="${pageContext.request.contextPath}/recruit/' + object.recId+'/">';
                    content +=''+ object.companyName + '</a></span></div>';
                    content += '<div  style="width: 250px;float: left;text-align: center;margin-left: 35px;"><span class="title2">' + object.recJobAddress + '</span></div>';
                    content += '<div  style="width: 250px;float: left;text-align: center;margin-left: 20px;"><span  class="title3">';
                    content += ' ' + object.recJobSalary + '</a>';
                    content += ' </span></div>';
                    content +='</div>';
                    content +='<br>';
                    $("#jobList").append(content);
                    content = "";
                });
                Sfgetpages(result);
            }
        });

        function Sfgetpages(result){
            layui.use(['laypage','layer'],function(){
                var laypage = layui.laypage
                    ,layer = layui.layer;
                laypage.render({
                    elem:'demo0',
                    theme: '#ff8c00',
                    count:result.data.total,
                    limit:10,
                    curr:pageNo,
                    jump:function(obj,first){
                        pageNo = obj.curr;
                        if(!first){
                            search(pageNo,salary,companyType,companySize,education);
                            $("#jobList").empty("");
                        }
                    }

                });
            })
        }

    }



    layui.use(['form', 'layedit', 'laydate', 'laypage', 'layer'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        //监听指定开关
        form.on('select(salary)', function (data) {
            salary = data.value;
            console.log(salary);
        });
        form.on('select(companyType)', function (data) {
            companyType = data.value;
            console.log(companyType);
        });
        form.on('select(companySize)', function (data) {
            console.log(data.value);
            companySize = data.value;
            console.log(companySize);
        });
        form.on('select(education)', function (data) {
            education = data.value;
            console.log(education);
        });
    });
    $("#sea").click(function () {
        console.info("2222222222222222");
        $("#jobList").empty("");
        search(pageNo, salary, companyType, companySize, education);
    });


</script>


<script>
    layui.use('layer', function () { //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句

        //触发事件
        var active = {
            setTop: function () {
                var that = this;

            }

            , notice: function () {
                //示范一个公告层
                layer.open({
                    type: 1
                    , title: false //不显示标题栏
                    , closeBtn: false
                    , area: '300px;'
                    , shade: 0.5


                    , id: 'LAY_layuipro' //设定一个id，防止重复弹出
                    , btn: ['确定', '退出']
                    , btnAlign: 'c'
                    , moveType: 1 //拖拽模式，0或者1
                    , content: '<div  class="script-address" >' +
                        ' <ul >' +
                        '<li >苏州<li/>' +
                        '<li >苏州<li/>' +

                        '</ul> ' +
                        ' <br><br>' +
                        ' <ul >' +
                        '<li >上海<li/>' +
                        '<li >上海<li/>' +
                        '</ul> ' +
                        '<br><br>' +
                        ' <ul >' +
                        '<li >南京<li/>' +
                        '<li >南京<li/>' +
                        '</ul> ' +
                        '<br><br>' +
                        ' <ul >' +
                        '<li >北京<li/>' +
                        '<li >北京<li/>' +
                        '</ul> ' +
                        '<br><br>' +
                        ' <ul >' +
                        '<li >成都<li/>' +
                        '<li >成都<li/>' +
                        '</ul> ' +
                        '</div>'
                    , success: function (layero) {
                        var btn = layero.find('.layui-layer-btn');
                        btn.find('.layui-layer-btn0').attr({
                            href: '${pageContext.request.contextPath}/zhaoPin/resume%20center.jsp'
                            , target: '_blank'
                        });
                    }
                });
            }

        };

        $('#layerAddress .layui-btn').on('click', function () {
            var othis = $(this), method = othis.data('method');
            active[method] ? active[method].call(this, othis) : '';
        });

    });

    $('#layerfunction .layui-btn').on('click', function () {
        var othis = $(this), method = othis.data('method');
        active[method] ? active[method].call(this, othis) : '';
    });


</script>


<script>
    function selectAllJobs() {
        var isSelectAll = document.querySelector(".select-all2").checked;  // true false
        var jobs = document.querySelectorAll("input[name='job']");
        var job_values = "";
        for (var i = 0; i < jobs.length; i++) {
            jobs[i].checked = isSelectAll;
            if (jobs[i].checked)
                job_values += jobs[i].value + ",";
        }

        console.log("所选的公司：" + job_values);

    }
</script>

<script>
    function selectkey() {
        var key = $("#sel").val();
        var urlSrt = "${pageContext.request.contextPath}/recruitList/select?selectkey=" + key;
        console.log(key);
        window.location.href = urlSrt;
    }
</script>
</div>
</body>
</html>



